package com.iafme.service.impl;

import cn.zhxu.bs.BeanSearcher;
import cn.zhxu.bs.operator.Contain;
import cn.zhxu.bs.util.MapUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.iafme.dto.req.EnterLevelReqDTO;
import com.iafme.dto.req.ExamReqDTO;
import com.iafme.dto.res.EnterLevelResDTO;
import com.iafme.model.Level;
import com.iafme.mapper.LevelMapper;
import com.iafme.service.ILevelService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.iafme.utils.ExamSignUtils;
import com.systemframework.util.SearchUtl;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author summer
 * @since 2025/01/05 21:14:40
 */
@Service
@AllArgsConstructor
public class LevelServiceImpl extends ServiceImpl<LevelMapper, Level> implements ILevelService {

    private final BeanSearcher beanSearcher;

    @Override
    public Page<EnterLevelResDTO> lists(EnterLevelReqDTO enterLevelReqDTO) {
        Map<String, Object> build = MapUtils.builder().page(enterLevelReqDTO.getPageNum()-1, enterLevelReqDTO.getPageSize())
                .field(EnterLevelResDTO::getName, enterLevelReqDTO.getName()).op(Contain.class)
                .field(EnterLevelResDTO::getProjectName, enterLevelReqDTO.getProjectName()).build();
        return SearchUtl.searchDataList(enterLevelReqDTO.getPageNum(), enterLevelReqDTO.getPageSize(), beanSearcher.search(EnterLevelResDTO.class,build));
    }

}
